Skip to content

Fix parsing of uppercase PEP 440 release tags - #1000

Open
8hjkkwikl8 wants to merge 1 commit into
python-poetry:mainfrom
8hjkkwikl8:fix/uppercase-pep440-release-tags
Open

8hjkkwikl8 wants to merge 1 commit into
python-poetry:mainfrom
8hjkkwikl8:fix/uppercase-pep440-release-tags

Conversation

@8hjkkwikl8

Copy link
Copy Markdown

Resolves: python-poetry#11235

What changed

ReleaseTag now lowercases phase before the spelling lookup, so Version.parse("1.0RC1") produces the same tag as Version.parse("1.0rc1").

Why

PEP 440 phase spellings are case-insensitive. The parser regex is case-insensitive and preserves the input's case, but RELEASE_PHASE_NORMALIZATIONS only has lowercase keys. Uppercase tags therefore stayed uppercase, which made Version.parse("1.0A1") != Version.parse("1.0a1"), sorted 1.0RC1 before 1.0a1, and stopped ==1.0RC1 from allowing 1.0rc1.

Tests

  • tests/version/pep440/test_segments.py: uppercase spellings for ReleaseTag normalization.
  • tests/constraints/version/test_version.py: uppercase pre-release, post-release, and dev tags parse and normalize like their lowercase forms.

Targeted run: 316 passed. Full suite on Windows: 2964 passed, 3 skipped, 6 failed; the six failures are C-extension wheel builds that need MSVC, which this machine does not have.

AI assistance disclosure: I used AI assistance to reproduce the issue and draft this change; I reviewed the diff and tests.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!

Sourcery assessment

Approved.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

@8hjkkwikl8

Copy link
Copy Markdown
Author

The Tests and Poetry Downstream Tests workflows for this PR are still marked action_required (workflow runs from a first-time contributor need a maintainer to approve them). Could someone with workflow-approval rights trigger the runs when convenient? I am happy to address any failures that come out of them.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant